package com.cypher.encryptionanddecryption.util;

import org.apache.commons.lang3.StringUtils;

/**
 * 变量操作工具
 */
public class VariableUtils {
    public final static String EMPTY = "";

    /**
     * 判断多个字符串对象是否为空
     * @param strs
     * @return
     *      只要有一个为空返回true，反之返回false
     */
    public static boolean isEmpty(String... strs) {
        for (String str : strs) {
            if (StringUtils.isEmpty(str))
                return true;
        }
        return false;
    }

    public static int getIndexByArray(Object[] arr, String param) {
        int index = 0;
        for (int i = 0; i < arr.length;i++) {
            if (StringUtils.equals(param, arr[i].toString())) {
                index = i;
            }
        }
        return index;
    }
}
